var doc=document;

        // 获取终端的相关信息
var Terminal = {
    // 辨别移动终端类型
    platform : function(){
        var u = navigator.userAgent, app = navigator.appVersion;
        return {
            // android终端或者uc浏览器
            android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
            // 是否为iPhone或者QQHD浏览器
            iPhone: u.indexOf('iPhone') > -1 ,
            // 是否iPad
            iPad: u.indexOf('iPad') > -1
        };
    }(),
    isWeixin:function(){
        //判断是否为微信
        var ismicr;
        if(Terminal.platform.android){
            ismicr = (navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == "micromessenger");
        }else if(Terminal.platform.iPhone){
            ismicr=(navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == "micromessenger")|| navigator.userAgent.match(/qq/i) == "qq";
        }else{
            ismicr=false;
        }
        return ismicr;
    },
    // 辨别移动终端的语言：zh-cn、en-us、ko-kr、ja-jp...
    language : (navigator.browserLanguage || navigator.language).toLowerCase()
};
        
function showOrhide(){
    var linkUrl=download.androidUrl;
    if(Terminal.platform.android){
        location.href=linkUrl;
    }else if(Terminal.platform.iPhone){
        promptInfo();
//        location.href=download.iosUrl;
    }else if(Terminal.platform.iPad){
//        location.href=download.iosUrl;
        promptInfo();
    }else{
        location.href=linkUrl;
    }
} 

// 根据不同的终端，跳转到不同的地址
doc.querySelector(".homepage").addEventListener("click",function(){
    showOrhide();
//    location.href="http://www.shidiquan.cn/indexPhone.html";
});

function promptInfo(){
    if (Terminal.isWeixin()){ //下如果是微信浏览器,提示在浏览器中打开 
       $(".indicator").find(".img2").css("display","block")
                      .siblings().css("display","none");
       $(".loading-indicator").css("display","block");
//    var newUrl=location.href+"?name=1&flags=yes";
//    history.replaceState("1","",newUrl);
       var newUrl=location.href+"&flags=yes";
       location.href=newUrl;
    } else { //不是微信浏览器的时候所做的判断
       $(".indicator").find(".img2").css("display","none")
                      .siblings().css("display","none");
       $(".loading-indicator").css("display","none");
       location.href=download.iosUrl;
    }
}